package com.example.demo.servise.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.dao.bookdao_order;
import com.example.demo.domain.order;
import com.example.demo.servise.ibookorder;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ibookorderimpl extends ServiceImpl<bookdao_order, order> implements ibookorder {
    @Autowired
    private bookdao_order bkd;

    @Override
    public IPage<order> getPage(int currentPage, int pageSize) {
        IPage page=new Page(currentPage,pageSize);
        bkd.selectPage(page,null);
        return page;
    }

    @Override
    public IPage<order> getPage(int currentPage, int pageSize, order con) {
        LambdaQueryWrapper<order> lqw =new LambdaQueryWrapper<order>();
        lqw.like(con.getId()!=null,order::getId,con.getId());
        lqw.like(Strings.isNotEmpty(con.getOrderPrice()),order::getOrderPrice,con.getOrderPrice());
        lqw.like(con.getOrderPay() !=null,order::getOrderPay,con.getOrderPay());
        IPage page=new Page(currentPage,pageSize);
        bkd.selectPage(page,lqw);
        return page;
    }

}
